package net.sky.oa.dao.system.impl;

import java.util.List;

import net.sky.oa.dao.SkyBaseDaoImpl;
import net.sky.oa.dao.system.SysSchoolDao;
import net.sky.oa.model.SysSchool;

import org.springframework.stereotype.Repository;

@SuppressWarnings("unchecked")
@Repository
public class SysSchoolDaoImpl extends SkyBaseDaoImpl<SysSchool> implements SysSchoolDao {
	
	public SysSchoolDaoImpl() {
		super.setPersistType(SysSchool.class);
	}

	public List<SysSchool> findAllSchool() {
		String hql = "from SysSchool s";
		return findByHql(hql);
	}
	
	public List<SysSchool> comboSch() {
		String hql = "select new SysSchool(s.id,s.name) from SysSchool s where status =" + 1;
		return findByHql(hql);
	}
	
	public List<SysSchool> findByName(String name){
		String hql = "from SysSchool d where d.name=?";
		Object[] params = { name };
		return findByHql(hql, params);
	}
}